package com.twobu.twobuinsight.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * 应用启动完成后执行的操作
 */
@Component
public class ApplicationStartupRunner implements ApplicationRunner {

    private static final Logger logger = LoggerFactory.getLogger(ApplicationStartupRunner.class);

    @Value("${server.port:8080}")
    private String serverPort;

    @Override
    public void run(ApplicationArguments args) {
        logger.info("==========================================================");
        logger.info("应用启动完成!");
        logger.info("Knife4j 文档地址: http://localhost:{}/doc.html", serverPort);
        logger.info("Swagger 文档地址: http://localhost:{}/swagger-ui/index.html", serverPort);
        logger.info("==========================================================");
    }
}
